import { PathRouteProps, useOutletContext } from 'react-router-dom';

export type MGFeature = 'p2p' | '';

export interface MGApplicationItemProps extends PathRouteProps {
    title?: React.ReactNode | string;
    icon?: React.ReactNode | string;
    isMenu?: boolean;
    layoutHiden?: boolean;
}

export interface MGApplicationProps {
    name?: React.ReactNode | string;
    logo?: React.ReactNode | string;
    index?: string;
    pages?: Array<MGApplicationItemProps>;
    settings?: Array<{
        group: string,
        children: Array<{ icon: React.ReactNode | string, title: React.ReactNode | string, code: string, element: React.ReactNode }>
    }>;
    features?: Array<MGFeature>;
    chatPageShown?: boolean;
    devicesPageShown?: boolean;
    peerPageShown?: boolean;
    options?: { [key: string]: any };
}

export type LayoutContextType = [string | null, string | null, MGApplicationProps]

export function useLayoutContext() {
    return useOutletContext<LayoutContextType>()
}
